<template>
  <view class="page-detail">
    <view class="navbar">
      <view class="header-info">
        <u-icon class="u-icon" color="#fff" size="22" name="arrow-left" @click="goBack()"></u-icon>
        <view class="title">企业信息</view>
      </view>
    </view>
    <view class="top-box">
    </view>
    <view class="context">
      <view class="number-title"></view>
      <u-cell-group title-bg-color="rgb(243, 244, 246)" customStyle="{'font-size': '16px'}">
        <u-cell title="企业名称" :label="detail.qyName" center></u-cell>
        <u-cell title="统一社会信用代码" :value="detail.nssbh" center></u-cell>
        <u-cell title="注册详细地址" :label="detail.zcxxdz" center></u-cell>
        <u-cell title="行政区划" :value="detail.streetName" center></u-cell>
        <u-cell title="法定代表人" :value="detail.fddbr" center></u-cell>
        <u-cell title="法人电话" :value="detail.fzrdh" center></u-cell>
        <u-cell title="注册资金" :value="detail.zczj" center></u-cell>
        <u-cell title="注册时间" :value="detail.zcsj" center></u-cell>
        <u-cell title="经营年限" :value="detail.jynx" center></u-cell>
        <u-cell title="核定产能" :value="detail.hdcn" center></u-cell>
        <u-cell title="释放产能" :value="detail.sfcn" center></u-cell>
        <u-cell title="经营范围" :value="detail.jyfw" center></u-cell>
        <u-cell title="生产煤种" :value="detail.scmzNameInfo" center></u-cell>
        <u-cell title="业务联系人" :value="detail.ywlxr" center></u-cell>
        <u-cell title="业务联系电话" :value="detail.ywlxdh" center></u-cell>
        <u-cell title="实际控制人" :value="detail.sjkgr" center></u-cell>
        <u-cell title="实际控制人电话" :value="detail.sjkgrdh" center></u-cell>
      </u-cell-group>
    </view>

  </view>
</template>

<script>
  import {
    getByCorpId
  } from "@/api/cockpit/cockpit";
  export default {
    props: {
      ticketCode: {
        type: String
      },
      pCode: {
        type: String
      }
    },
    data() {
      return {
        detail: {},
      }
    },
    onShow() {
      this.getDetail();
    },
    onLoad(option) {
      this.code = option.ticketCode;
    },
    methods: {
      goBack() {
        uni.navigateBack({
          delta: 2, // 返回上2级页面
        });
      },
      async getDetail() {
        let res = await getByCorpId({ corpId: this.code }) || {}
        this.detail = res.data
        if (this.detail.scmzName.length > 0) {
          this.detail.scmzNameInfo = this.detail.scmzName.toString();
        }
      },

      preview() {
        this.$tab.navigateTo(`/pages/common/qrcode/index?code=${this.detail.ticketCode}`)
      },
      // 回显煤种数据文本
      getCoalTexts(datas, value, separator) {
        if (value === undefined) {
          return "";
        }
        if (datas == undefined) {
          return value;
        }
        var actions = [];
        var currentSeparator = undefined === separator ? "," : separator;
        var temp = value.split(currentSeparator);
        Object.keys(value.split(currentSeparator)).some((val) => {
          var match = false;
          Object.keys(datas).some((key) => {
            if (datas[key].coalNum == "" + temp[val]) {
              actions.push(datas[key].coalName + currentSeparator);
              match = true;
            }
          });
          if (!match) {
            actions.push(temp[val] + currentSeparator);
          }
        });
        return actions.join("").substring(0, actions.join("").length - 1);
      }
    }
  }
</script>

<style lang="less" scoped>
  .page-detail {
    .navbar {

      .header-info {
        display: flex;
        height: 90rpx;
        line-height: 90rpx;
        margin-top: 86rpx;

        .u-icon {
          width: 10%;
          padding-left: 25rpx;
        }

        .title {
          font-size: 36rpx;
          font-weight: 500;
          color: #FFFFFF;
          text-align: center;
          width: 75%;
        }

        .right-btn {
          color: #fff;
          font-size: 36rpx;
        }
      }


    }

    .top-box {
      background-image: url("/static/images/common/list-top-bg.png");
      background-repeat: no-repeat;
      background-size: 100%;
      height: 16rpx;
      margin: 186rpx 20rpx 0 20rpx;
    }

    .context {
      background-color: #ffffff;

      .number-title {
        font-size: 28rpx;
        color: #233239;
        padding-top: 10rpx;
        padding-bottom: 10rpx;
        padding-right: 28rpx;
        text-align: right;
      }

      /deep/.u-cell {
        line-height: 96rpx;
      }

      /deep/.u-cell__title-text {
        font-size: 32rpx;
        color: #666666;
      }

      /deep/.u-cell__value {
        font-size: 34rpx;
        color: #333333;
      }

      /deep/.u-cell__label {
        font-size: 34rpx;
        color: #333333;
        ;
      }
    }

    .step-box {
      background: #ffffff;
      border-radius: 15rpx 15rpx 15rpx 15rpx;
    }
  }
</style>